public class Rumble
{
    private float rumbleTimer;
    bool enableRumble;

    public Rumble()
    {
        enableRumble = false;
    }

    public void Update(float elapsed, PlayerIndex playerIndex)
    {
        if (enableRumble)
        {
            if (rumbleTimer > 0f)
            {
                rumbleTimer -= elapsed;
            }
            else
            {
                enableRumble = false;
                rumbleTimer = 0f;
                GamePad.SetVibration(playerIndex, 0, 0);
            }
        }
    }

    // Example rumble effect for gunshots
    public void Rumble_GunShot(PlayerIndex playerIndex)
    {
        rumbleTimer = .15f;
        enableRumble = true;
        GamePad.SetVibration(playerIndex, 1, 1);
    }

    // Example rumble effect when the player is killed
    public void Rumble_Killed(PlayerIndex playerIndex)
    {
        rumbleTimer = .75f;
        enableRumble = true;
        GamePad.SetVibration(playerIndex, .75f, .75f);
    }
}
/*
// Create the rumble object as a global variable
private Rumble rumbleObject = new Rumble();

// Run this code when you want to start your rumble effect
rumbleObject.Rumble_GunShot(PlayerIndex.One);

// Put this code in your update loop so that it updates the rumble effect
rumbleObject.Update(elapsed, PlayerIndex.One);
*/